using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PaoGuan : MonoBehaviour
{
    // 炮管旋转速度
    public float speed = 20;


    public Transform rotateBase;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.R))
        {
            this.transform.RotateAround(this.rotateBase.position, this.rotateBase.forward, speed * Time.deltaTime);
        }
        else if (Input.GetKey(KeyCode.F))
        {
            this.transform.RotateAround(this.rotateBase.position, this.rotateBase.forward, speed * -1 * Time.deltaTime);
        }

        if (Input.GetKey(KeyCode.Q))
        {
            this.transform.RotateAround(this.rotateBase.position, this.rotateBase.up, speed * Time.deltaTime);
        }
        else if (Input.GetKey(KeyCode.E))
        {
            this.transform.RotateAround(this.rotateBase.position, this.rotateBase.up, speed * -1 * Time.deltaTime);
        }
    }
}
